﻿@using Bll
@using DAL
@model MD<AdmColListModel>
@{
    ViewBag.Title = "操作";
}
<div class="row-fluid">
    <div class="span8 offset1">
        @{
            var selectmode = new SimpComm.SelectBoxModel
                                 {
                                     ControlID = "ClassLevel",
                                     DataBind = new List<SimpComm.SelectBoxView>
                                                    {
                                                        new SelectBoxView("0", "全部等级"),
                                                        new SelectBoxView("1", "第一级"),
                                                        new SelectBoxView("2", "第二级")
                                                    },
                                     DefaultValue = Model.GetDefaultValue("ClassLevel")
                                 };
        }
        @Html.Partial("~/Views/Tool/_SelectBox.cshtml", selectmode)
        @{
            var SelectData1 = AdmColService.Instance.SM(new SMP<AdmCol, SelectBoxView>()
                                                            {

                                                                pageSize = 8,
                                                                selected = p => p.ClassLevel == 1,
                                                                getmodel = p => new SelectBoxView()
                                                                                    {
                                                                                        Value = p.ID.ToString(),
                                                                                        Text = p.Name
                                                                                    },
                                                            }).Datas;
            SelectData1.Insert(0,new SelectBoxView("0", "所有栏目"));
            var selectmode1 = new SimpComm.SelectBoxModel
            {
                ControlID = "AdmColID",
                DataBind = SelectData1,
                DefaultValue = Model.GetDefaultValue("AdmColID")
            };
        }
        @Html.Partial("~/Views/Tool/_SelectBox.cshtml", selectmode1)
    </div>
    <div class="span1">
        <div class="btn-group">
            <script type="text/javascript">
                function SubmitSelectValue() {
                    $.get('@(Url.Action(Html.ViewContext.RouteData.Values["action"].ToString(), Html.ViewContext.RouteData.Values["controller"].ToString()))',
                        { "ClassLevel": $("#ClassLevel").val(), "AdmColID": $("#AdmColID").val() })
                        .done(function (data) {
                            $("#ajax_target").html(data);
                        });
                }
            </script>
            <button class="btn" onclick="SubmitSelectValue()">
                提交</button>
        </div>
    </div>
</div>
<table class="table table-hover">
    <tr>
        <th>
            <input type="checkbox" onclick="checkbox_CheckAll(this)">
        </th>
        <th>
            ID
        </th>
        <th>
            姓名
        </th>
        <th>
            路径
        </th>
        <th>
            小类别
        </th>
        <th>
        </th>
    </tr>
    @foreach (var item in Model.Datas)
    {
        <tr>
            <td>
                <input type="checkbox" id="@item.ID">
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ID)
            </td>
            <td>
                @*                @Html.DisplayFor(modelItem => item.Name)*@ <a title="查看详情" data-title="详情(ID @item.ID )" data-trigger="modal"  href="@Url.Action("Details", new { ID = item.ID })">@item.Name</a>
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Url)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.SmallClass)
            </td>
            <td>
                <a class="btn" title="修改该行" data-title="修改(ID @item.ID )" data-trigger="modal"  href="@Url.Action("Opear", new { id = item.ID })">
                    <i class="icon-edit"></i></a><a data-trigger="confirm"  data-href="@Url.Action("Delete")" data-ID="@item.ID" class="btn" data-content="你确定删除该记录" title="删除" data-action="AjaxDelete">
                        <i class="icon-remove"></i></a>
            </td>
        </tr>
    }
</table>
<p>
    @{
        var myroutes = new Dictionary<string, object>();
        myroutes.Add("select", "value");
    }
    @Html.Partial("~/Views/Tool/_Pager.cshtml", Model.GetPageMode())
</p>
<div class="btn-toolbar">
    <a class="btn btn-small mr15"   data-title="添加" data-trigger="modal"  href="@Url.Action("Opear")">
        <i class="icon-plus"></i>添加</a>
    <div class="btn-group">
        <button class="btn dropdown-toggle" data-toggle="dropdown">
            批量操作 <span class="caret"></span>
        </button>
        <ul class="dropdown-menu">
            <li><a data-trigger="confirm"  data-href="@Url.Action("MulDelete")"  data-content="你确定删除多条该记录" title="批量删除" data-action="AjaxMulDelete">
                <i class="icon-edit"></i>批量删除</a></li>
        </ul>
    </div>
</div>
